<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
    <title>用户注册</title>
</head>
<body>
<font size="5" color="red">欢迎注册php.cn</font>
<form id="fm" name="user" action="" >
    用户名：<input type="text" name="username"/>
    <br/>
    密码：<input type="password" name="userpwd"/>
    <br/>
    性别：<input type="radio" name="sex" value="男" >男
    <input type="radio" name="sex" value="女">女
    <br/>
    爱好：<input type="checkbox" name="hobby" value="运动">运动
    <input type="checkbox" name="hobby" value="看电影">看电影
    <input type="checkbox" name="hobby" value="编程" >编程
    <input type="checkbox" name="hobby" value="宅着">宅着
    <br/><input id="sumt" type="submit" value="提交信息"/>
</form>
</body>
<script>
    $(function(){

        $('#sumt').click(function(){
            var temp=$('#fm').serialize();
            alert(temp)
            $.ajax({
                type: "POST",
                url: "http://localhost:8080/temp",
                data: temp,
                success: function(msg){
                    alert( "Data Saved: " + msg );
                }
            });

        })

    })
</script>